const {
  productCreated,
  productUpdated,
  productList,
  // productDeleted,
  // productDetails,
} = require('../../controllers/admin/products.js')

const { verifyToken } = require('../../utils/jwt.js')

const Products = (fastify, opts, done) => {
  fastify.post('/product/created', { preHandler: verifyToken }, productCreated)
  fastify.post(
    '/product/updated/:productId',
    { preHandler: verifyToken },
    productUpdated
  )

  // fastify.delete(
  //   '/product/deleted/:productId',
  //   { preHandler: verifyToken },
  //   productDeleted
  // )
  fastify.get('/product/list', { preHandler: verifyToken }, productList)
  // fastify.get(
  //   '/product/details/:productId',
  //   { preHandler: verifyToken },
  //   productDetails
  // )
  done()
}

module.exports = Products
